package com.weipeep.dubbo.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.google.common.collect.Lists;
import com.weipeep.dubbo.request.UserInfoRequest;
import com.weipeep.dubbo.response.UserInfoResponse;
import com.weipeep.dubbo.service.TestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

@Service(version = "${hello.service.version}" )
@Component
public class TestServiceImpl implements TestService {
    private Logger log = LoggerFactory.getLogger(this.getClass());

    @Override
    public UserInfoResponse findById(long id) {
        UserInfoResponse userInfoResponse = new UserInfoResponse();
        userInfoResponse.setIdCard(""+id);
        userInfoResponse.setEmail(id+"@sina.com");
        userInfoResponse.setNickName(id+"_nickName");
        userInfoResponse.setRealName(id+"_realName");
        userInfoResponse.setSex(id%2==0?"男":"女");
        log.info("获取ID:{}",id);
        return userInfoResponse;
    }

    @Override
    public List<UserInfoResponse> getUserByRequest(UserInfoRequest userInfoRequest) {
        log.info("参数：{}",userInfoRequest.toString());
        return Lists.newArrayList();
    }

    @Override
    public List<UserInfoResponse> getUserByConditionSet(Set<String> idCardSet, Integer status, String userName) {
        log.info("参数：{},{},{}",idCardSet,status,userName);
        return Lists.newArrayList();
    }
    @Override
    public List<UserInfoResponse> getUserByConditionList(List<String> idCardSet, Integer status, String userName) {
        log.info("参数：{},{},{}",idCardSet,status,userName);
        return Lists.newArrayList();
    }
    @Override
    public UserInfoResponse getUserByIdCard(String idCard) {
        UserInfoResponse userInfoResponse = new UserInfoResponse();
        userInfoResponse.setIdCard(idCard);
        userInfoResponse.setEmail(idCard+"@sina.com");
        userInfoResponse.setNickName(idCard+"_nickName");
        userInfoResponse.setRealName(idCard+"_realName");
        userInfoResponse.setSex(idCard.length()%2==0?"男":"女");
        return userInfoResponse;
    }

}
